﻿using Microsoft.AspNetCore.Mvc;
using WMS.FC.Application.Location.Interface;
using WMS.FC.Domain.DataTransferObject.Location;
using WMS.FC.Domain.DataTransferObject.System;
using WMS.FC.Infrastructure.Filter;

namespace WMS.FC.WebApi.Controllers
{
    /// <summary>
    /// 货位控制器
    /// </summary>
    public class LocationController : BaseConroller
    {
        /// <summary>
        /// 货位服务
        /// </summary>
        protected readonly ILocationService locationService;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="locationService"></param>
        public LocationController(ILocationService locationService)
        {
            this.locationService = locationService;
        }

        /// <summary>
        /// 添加货位
        /// </summary>
        /// <param name="dTO"></param>
        /// <returns></returns>
        [HttpPost]
        [TypeFilter(typeof(WMSFilter))]
        public async Task<IActionResult> AddLocation(AddDataDTO<AddLocationDTO> dTO)
        {
            var response = await locationService.AddLocation(dTO);
            return Ok(response);
        }
    }
}
